// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import echarts from 'echarts'
// import * as echarts from 'echarts';
import DataV from '@jiaminghi/data-view'
import Video from 'video.js'
import 'video.js/dist/video-js.css'
import axios from 'axios'
import qs from 'qs'
import MetaInfo from 'vue-meta-info'
Vue.use(MetaInfo)
Vue.use(DataV)
// qs主要有两种使用方法：qu.stringify()和qs.parse();
// qu.stringify():将对象序列化成url的形式；以&进行拼接
// qs.parse():将url解析成对象形式；
Vue.prototype.$video = Video

// 视频播放
// import VideoPlayer from 'vue-video-player'
require('video.js/dist/video-js.css')
// require('vue-video-player/src/custom-theme.css')
// Vue.use(VideoPlayer);

// import vueAwesomeSwiper from 'vue-awesome-swiper'
// Vue.use(vueAwesomeSwiper);
// import VClamp from 'vue-clamp'
//使用百度统计访问量
// import ba from 'vue-ba'

// Vue.component('VClamp', VClamp)

//生产环境，url也可以在http请求路径中添加
// axios.defaults.baseURL = 'http://116.62.155.72:8004/'
// axios.defaults.baseURL = 'http://honglitech.cn:8004/'
axios.defaults.baseURL = 'http://localhost:8004/'
// axios.defaults.withCredentials = true // 允许跨域携带cookie信息，使请求带上凭证信息，查询普通数据不起作用
Vue.prototype.$http = axios
// Vue.prototype.$echarts=echarts

// Vue.use(ElementUI);


Vue.config.productionTip = false

// Vue.use(ba, "194d566dedfa8b15be2b37fb95655dfd");
// Vue.use(ba, { siteId: "194d566dedfa8b15be2b37fb95655dfd" });
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

// router.afterEach((to, from, next) => {
  // comFun.hasToken().then(() => { //确保拿到token之后
  //   let url = 'https://hi.189.cn/equitiesWebTest' + to.fullPath
  //   comFun.setPVUV(url, to.meta.title)
  // })
  //hasToken和setPVUV方法都在common.js中，导出对象名是comFun
  //统计页面PV和UV
  // const setPVUV = (url, title) => {
  //   let data = {
  //     webId: "equities",  //网页标识符
  //     url: url,  //当前页面url
  //     webName: title,  //网页名称
  //     openId: sessionStorage.getItem('openId'),
  //     phoneNum: sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')).phoneNum : store.state.userInfo.phoneNum //手机号码
  //   }
  //   //调用封装好的接口方法
  //   api.setPVandUV(data).then(res => {
  //     console.log('PVUV '+res)
  //   }).catch(err => {
  //     console.log(err)
  //   })
  // }
// })
